.custom-select-wrapper {
    font-family: var(--screen-font-family);
    background-color: var(--content-bg);
    border-radius: inherit;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    text-align: center;
    color: var(--screen-text-color);
    font-size: 1.5rem;
    transition: all 0.1s ease;
    min-width: 40ch;
    max-width: 40ch;
    padding: 5px;
    border: none;
    position: relative;
}

.custom-select-trigger {
    width: 100%;
    background: var(--content-bg);
    color: var(--screen-text-color);
    border: var(--main-border);
    border-radius: var(--mini-screen-border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--main-font-size);
    transition: all 0.3s ease;
    user-select: none;
    box-sizing: border-box;
}

.custom-select-trigger:hover {
    background: var(--screen-bg);
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
}

.custom-select-value {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.custom-select-value .marquee-text {
    display: inline-block;
    white-space: nowrap;
}

.custom-select-value.needs-marquee .marquee-text {
    animation: marquee-scroll 8s linear infinite;
    padding-right: 50px;
}

.custom-select-value.needs-marquee .marquee-text::after {
    content: attr(data-text);
    position: absolute;
    left: 100%;
    padding-left: 50px;
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.custom-select-arrow {
    position: absolute;
    right: 12px;
    transition: transform 0.3s ease;
    color: var(--screen-text-color);
    opacity: 0.7;
    font-size: 0.8em;
}

.custom-select-dropdown {
    position: fixed;
    background: var(--content-bg);
    border: var(--main-border);
    border-radius: var(--mini-screen-border-radius);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
}

.custom-select-dropdown.show {
    max-height: 400px;
    opacity: 1;
}

.custom-select-options {
    flex: 1;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px 0;
    order: 1;
}

.custom-select-search {
    position: relative;
    padding: 10px;
    border-top: 1px solid var(--main-border-color);
    background: var(--screen-bg);
    order: 2;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--screen-text-color);
    opacity: 0.5;
    pointer-events: none;
}

.custom-select-search-input {
    width: 100%;
    padding: 8px 12px 8px 35px;
    background: var(--content-bg);
    color: var(--screen-text-color);
    border: 1px solid var(--main-border-color);
    border-radius: var(--mini-screen-border-radius);
    font-size: var(--main-font-size);
    font-family: var(--screen-font-family);
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.custom-select-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4);
}

.custom-select-search-input::placeholder {
    color: var(--screen-text-color);
    opacity: 0.5;
}

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: var(--screen-bg);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.custom-select-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--screen-text-color);
    font-size: var(--main-font-size);
    user-select: none;
}

.custom-select-option:hover {
    background: var(--screen-bg);
    padding-left: 20px;
}

.custom-select-option.selected {
    background: var(--accent-color);
    color: var(--btn-text-color);
    font-weight: bold;
}

.custom-select-option.selected:hover {
    background: var(--primary-color);
}

.custom-select-no-results {
    padding: 20px;
    text-align: center;
    color: var(--screen-text-color);
    opacity: 0.6;
    font-size: var(--main-font-size);
    font-style: italic;
}

@media (max-width: 768px) {
    .custom-select-wrapper {
        height: 1rem;
        font-size: 1rem;
        min-width: 25ch;
        max-width: 25ch;
    }
    .custom-select-dropdown.show {
        max-height: 300px;
    }
    .custom-select-options {
        max-height: 250px;
    }
    .custom-select-search-input {
        font-size: 16px;
    }
    .custom-select-option {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}